package org.game.msgBuilder;

import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.game.db.vo.PlayerDataVO.ResBuyRecordVO;
import org.game.protobuf.s2c.S2CPlayerMsg.BuyResourcesLog;
import org.game.protobuf.s2c.S2CShareMsg.ChangeType;

import com.google.common.base.Splitter;
import com.google.common.collect.Lists;

/**
 * @author : DengYing
 * @CreateDate : 2017年8月17日 下午5:32:54
 * @Description ：任务管理器
 */
public class ResourceLogMsgBuilder {
	
	public static List<BuyResourcesLog> buildResourceLogMsg(ChangeType changeType,Map<Integer, ResBuyRecordVO> map){
		List<BuyResourcesLog> logs = Lists.newArrayList();
		for (Entry<Integer, ResBuyRecordVO> e : map.entrySet()) {
			logs.add(buildResourceLogMsg(changeType,e.getKey(),Integer.valueOf(e.getValue().getCount())));
		}
		return logs;
	}

	public static BuyResourcesLog buildResourceLogMsg(ChangeType changeType,int cid,int count) {
		BuyResourcesLog.Builder log = BuyResourcesLog.newBuilder();
		log.setCt(changeType);
		log.setCid(cid);
		log.setCount(count);
		return log.build();
	}
}
